package com.kaoshi.myweb.snippet.mq.rabbitmq.spring.integration;

import org.springframework.amqp.core.AmqpAdmin;
import org.springframework.amqp.core.AmqpTemplate;
import org.springframework.amqp.rabbit.connection.ConnectionFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service
public class TopicExchangeProductorService {

	@Autowired
	private AmqpAdmin admin;

	@Autowired
	private AmqpTemplate topicTemplate;

	@Autowired
	private ConnectionFactory connectionFactory;


	public void topicpushToMessageQueue(String routingKey, User user) {
		topicTemplate.convertAndSend(routingKey, user);
		System.out.println("成功插入消息 " + user);
	}

}
